﻿using System;
using System.Collections.Generic;
////using System.Linq;
using System.Text;

using Config = System.Configuration.ConfigurationManager;

namespace Reports
{
    class BaseConfig
    {
        /// <summary>
        /// 启用测试环境 还是正式环境
        /// </summary>
        public static bool If_Test
        {
            get
            {
                //读取config配置 
                if (Config.AppSettings["if_test"] != null && Config.AppSettings["if_test"].Equals("1"))
                    return true;
                else
                    return false;
            }
        }


        private static string _db1conn = string.Empty;
        public static string DB1
        {
            get
            {
                if (string.IsNullOrEmpty(_db1conn))
                    _db1conn = Config.ConnectionStrings["DB1"].ToString();
                return _db1conn;
            }
        }

        private static string _db2conn = string.Empty;
        /// <summary>
        /// web
        /// </summary>
        public static string DB2
        {
            get
            {
                if (string.IsNullOrEmpty(_db2conn))
                    _db2conn = Config.ConnectionStrings["DB2"].ToString();
                return _db2conn;
            }
        }


        private static string _webconn = string.Empty;
        /// <summary>
        /// web
        /// </summary>
        public static string Web
        {
            get
            {
                if (string.IsNullOrEmpty(_webconn))
                    _webconn = Config.ConnectionStrings["WEB"].ToString();
                return _webconn;
            }
        }

        private static string _skey = string.Empty;
        public static string SKey
        {
            get
            {
                if (string.IsNullOrEmpty(_skey))
                    _skey = Config.AppSettings["KEYS"].ToString();
                return _skey;
            }
        }

        private static string _configPath = string.Empty;

        public static string BasePath
        {
            get
            {
                if (string.IsNullOrEmpty(_configPath))
                    _configPath = System.AppDomain.CurrentDomain.BaseDirectory;
                return _configPath;
            }
        }
    }
}
